package com.juttec.freshbird.pet.base;

import android.app.Activity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.juttec.freshbird.pet.MainActivity;
import com.juttec.freshbird.pet.R;

/**
 * Created by Administrator on 2015/10/21.
 */
public abstract class BasePager {

    public Activity mActivity;
    public View mRootView;

    public BasePager(Activity activity) {
        mActivity = activity;
        mRootView = initViews();
    }

    public abstract View initViews();

    public void initData() {

    }

    //设置slidingmenu的打开方式为：全屏触摸，左开
    public void setSlidingMenuLeftEnable() {
        MainActivity mainUi = (MainActivity) mActivity;
        SlidingMenu slidingMenu = mainUi.getSlidingMenu();
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        slidingMenu.setMode(SlidingMenu.LEFT);
    }

    //设置slidingmenu的打开方式为：屏幕不可，右开
    public void setSlidingMenuRightEnable() {
        MainActivity mainUi = (MainActivity) mActivity;
        SlidingMenu slidingMenu = mainUi.getSlidingMenu();
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
        slidingMenu.setMode(SlidingMenu.RIGHT);
    }

    //设置slidingmenu的打开方式为：屏幕不可
    public void setSlidingMenuNone() {
        MainActivity mainUi = (MainActivity) mActivity;
        SlidingMenu slidingMenu = mainUi.getSlidingMenu();
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    }

    //切换slidingmenu时调用的方法
    public void toggleSlidingMenu() {
        MainActivity mainUi = (MainActivity) mActivity;
        SlidingMenu slidingMenu = mainUi.getSlidingMenu();
        slidingMenu.toggle();
    }

}
